import 'core-js/stable/promise'
import './assets/main.css'
import '@/styles/common.scss'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import {directivePlugin} from '@/directives'


import App from './App.vue'
import router from './router'
//测试接口函数
import { getCategoryAPI } from './apis/testAPI'
import {useIntersectionObserver} from "@vueuse/core";
getCategoryAPI().then(res=>{
  console.log(res);
})
const app = createApp(App)

app.use(createPinia())
app.use(router)
// 定义全局指令
app.directive('img-lazy',{
  mounted(el,binding)
  {
      // el 指令绑定的元素img
      // binding : binding.value 指令等于后面表达式的值
      console.log(el,binding.value)
      useIntersectionObserver(
        el,
        ([{isIntersecting}]) =>{
          console.log(isIntersecting)
        }
      )
  }
})


app.use(directivePlugin)
app.mount('#app')

